package com.qianli.cashmama.trade.dao;

import com.fqgj.common.api.Page;
import com.fqgj.common.base.BaseMapper;
import com.qianli.cashmama.trade.entity.TBillDeductFixEntity;
import com.qianli.cashmama.trade.entity.TBillEntity;
import com.qianli.cashmama.trade.entity.TTradeEntity;

import java.util.Date;
import java.util.List;

/**
 * User: sm
 * Date: 2017-07-21
 * Time: 09:10:21.126
 */

public interface TBillDao extends BaseMapper<TBillEntity> {
    /**
     * @param billNo
     * @return
     */
    TBillEntity selectOneByBillNo(String billNo);

    /**
     * @param tradeNo
     * @return
     */
    List<TBillEntity> selectListByTradeNo(String tradeNo);


    /**
     * @param tradeNos
     * @return
     */
    List<TBillEntity> selectPaidListByTradeNos(List<String> tradeNos);

    /**
     * @param tradeNos
     * @return
     */
    List<TBillEntity> selectListByTradeNos(List<String> tradeNos);

    /**
     * @param orderBillIds
     * @return
     */
    List<TBillEntity> selectListByOrderBillIds(List<Long> orderBillIds);


    /**
     * @param minId
     * @return
     */
    List<TBillEntity> selectByMinId();

    /**
     * @return
     */
    List<TBillEntity> selectListByRepaymentDates(List<Date> repaymentDateList, Page page);


    /**
     * 获取最近指定类目的倒叙还款历史
     *
     * @param categoryCode
     * @param userCode
     * @param size
     * @return
     */
    List<TBillEntity> selectLatestListByUserCodeAndCategoryCode(String categoryCode, String userCode, Integer size);

    /**
     * 查询逾期30天的数据
     */
    List<TBillEntity> selectMoreThan30DaysOverdueByLastOverTime(String lastOverTime);


    /**
     * 查询需要发送抵扣提醒短信的账单
     */
    List<TBillEntity> selectNeedSendDiscountRemindSmsBill(Long startId, int pageSize);

    /**
     * 查询需要展期账单
     *
     * @return
     */
    List<TBillEntity> selectTBillListForExtension(Date startDate, Date endDate);

    /**
     * 查询需要修复抵扣字段的历史账单
     *
     * @return
     */
    List<TBillDeductFixEntity> selectWaitingFixList(Page page);


    List<TBillEntity> getOldUnpaidBillListByMobile(String mobile);

    void copyInsert(TBillEntity entity);
}